mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Added page for forbbiden access to signed out users.
This commit is contained in:
		
							
								
								
									
										14
									
								
								assets/css/pages/userPage/accessForbidden.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								assets/css/pages/userPage/accessForbidden.css
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Access To Page Forbidden stylesheet
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @author Pierre HUBERT
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Callout special stylesheet
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					.user_page_access_forbidden {
 | 
				
			||||||
 | 
						margin: auto;
 | 
				
			||||||
 | 
						margin-top: 30px;
 | 
				
			||||||
 | 
						max-width: 500px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -390,6 +390,11 @@ var ComunicWeb = {
 | 
				
			|||||||
			 */
 | 
								 */
 | 
				
			||||||
			getNames: function(usersID, afterNames){},
 | 
								getNames: function(usersID, afterNames){},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								/**
 | 
				
			||||||
 | 
								 * Get advanced informations about a user
 | 
				
			||||||
 | 
								 */
 | 
				
			||||||
 | 
								getAdvancedInfos: function(userID, callback){},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/**
 | 
								/**
 | 
				
			||||||
			 * Get the user ID specified by its folder name
 | 
								 * Get the user ID specified by its folder name
 | 
				
			||||||
			 */
 | 
								 */
 | 
				
			||||||
@@ -667,8 +672,25 @@ var ComunicWeb = {
 | 
				
			|||||||
				 */
 | 
									 */
 | 
				
			||||||
				openUserPage: function(id, params, target){},
 | 
									openUserPage: function(id, params, target){},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									/**
 | 
				
			||||||
 | 
									 * Display a user page
 | 
				
			||||||
 | 
									 */
 | 
				
			||||||
 | 
									displayUserPage: function(infos, params, target){},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								/**
 | 
				
			||||||
 | 
								 * Page with access forbidden
 | 
				
			||||||
 | 
								 */
 | 
				
			||||||
 | 
								accessForbidden: {
 | 
				
			||||||
 | 
									
 | 
				
			||||||
 | 
									/**
 | 
				
			||||||
 | 
									 * Display the page for user with forbidden access
 | 
				
			||||||
 | 
									 */
 | 
				
			||||||
 | 
									display: function(id, params, target){}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/**
 | 
							/**
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										38
									
								
								assets/js/pages/userPage/accessForbidden.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								assets/js/pages/userPage/accessForbidden.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Display informations about pages we are not allowed to show
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * Handles request
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @author Pierre HUBERT
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ComunicWeb.pages.userPage.accessForbidden = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Display the page for user with forbidden access
 | 
				
			||||||
 | 
						 * 
 | 
				
			||||||
 | 
						 * @param {Integer} userID The ID of the target user
 | 
				
			||||||
 | 
						 * @param {Object} params Additional parametres
 | 
				
			||||||
 | 
						 * @param {HTMLElement} target The target element on the screen
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						display: function(id, params, target){
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							//Check if user is signed in or not
 | 
				
			||||||
 | 
							if(!signed_in()){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								//Inform user that he must sign in to continue
 | 
				
			||||||
 | 
								elem = ComunicWeb.common.messages.createCalloutElem(
 | 
				
			||||||
 | 
									"Sign in required",
 | 
				
			||||||
 | 
									"Please sign in to get access to this page.",
 | 
				
			||||||
 | 
									"danger"
 | 
				
			||||||
 | 
								);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								elem.className += " user_page_access_forbidden";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								target.appendChild(elem);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -83,7 +83,44 @@ ComunicWeb.pages.userPage.main = {
 | 
				
			|||||||
		//Log action
 | 
							//Log action
 | 
				
			||||||
		log("Open user page : " + id);
 | 
							log("Open user page : " + id);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							//Fetch informations about the user
 | 
				
			||||||
 | 
							ComunicWeb.user.userInfos.getAdvancedInfos(id, function(response){
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
								//Check for errors
 | 
				
			||||||
 | 
								if(response.error){
 | 
				
			||||||
 | 
									
 | 
				
			||||||
 | 
									//Check if the page was not found
 | 
				
			||||||
 | 
									if(response.error.code == 404){
 | 
				
			||||||
 | 
										ComunicWeb.common.error.pageNotFound(params, target);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									//Check if we are not allowed to get the informations
 | 
				
			||||||
 | 
									if(response.error.code == 401){
 | 
				
			||||||
 | 
										//Display access forbidden page
 | 
				
			||||||
 | 
										ComunicWeb.pages.userPage.accessForbidden.display(id, params, target);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								else {
 | 
				
			||||||
 | 
									//Display user page
 | 
				
			||||||
 | 
									ComunicWeb.pages.userPage.main.displayUserPage(response, params, target);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Display a user page
 | 
				
			||||||
 | 
						 * 
 | 
				
			||||||
 | 
						 * @param {Object} infos Informations about the user to display
 | 
				
			||||||
 | 
						 * @param {Object} params Parametres required to open the page
 | 
				
			||||||
 | 
						 * @param {HTMLElement} target Target of the user page
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						displayUserPage: function(infos, params, target){
 | 
				
			||||||
 | 
							console.log("Display user page based on the informations we got");
 | 
				
			||||||
 | 
							console.log(infos);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -201,6 +201,25 @@ ComunicWeb.user.userInfos = {
 | 
				
			|||||||
		});
 | 
							});
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Get advanced informations about a user
 | 
				
			||||||
 | 
						 * 
 | 
				
			||||||
 | 
						 * @param {Integer} userID The ID of the user to fetch
 | 
				
			||||||
 | 
						 * @param {Function} callback What to do once we got the information
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						getAdvancedInfos: function(userID, callback){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							//Prepare an API request
 | 
				
			||||||
 | 
							var apiURI = "user/getAdvancedUserInfos";
 | 
				
			||||||
 | 
							var params = {
 | 
				
			||||||
 | 
								userID: userID
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							//Perform the request
 | 
				
			||||||
 | 
							ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Get the user ID specified by its folder name
 | 
						 * Get the user ID specified by its folder name
 | 
				
			||||||
	 * 
 | 
						 * 
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,25 +32,29 @@ $config['CSSfiles'] = array(
 | 
				
			|||||||
	"%PATH_ASSETS%css/common/network/networkError.css",
 | 
						"%PATH_ASSETS%css/common/network/networkError.css",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//Components stylesheets
 | 
						//Components stylesheets
 | 
				
			||||||
	//Menubar stylesheet
 | 
							//Menubar stylesheet
 | 
				
			||||||
	"%PATH_ASSETS%css/components/menuBar.css",
 | 
							"%PATH_ASSETS%css/components/menuBar.css",
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
	//Searchform stylesheet
 | 
							//Searchform stylesheet
 | 
				
			||||||
	"%PATH_ASSETS%css/components/searchForm.css",
 | 
							"%PATH_ASSETS%css/components/searchForm.css",
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
	//Friendbar stylesheet
 | 
							//Friendbar stylesheet
 | 
				
			||||||
	"%PATH_ASSETS%css/components/friends/friendsBar.css",
 | 
							"%PATH_ASSETS%css/components/friends/friendsBar.css",
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
	//Conversations stylesheet
 | 
							//Conversations stylesheet
 | 
				
			||||||
	"%PATH_ASSETS%css/components/conversations/manager.css",
 | 
							"%PATH_ASSETS%css/components/conversations/manager.css",
 | 
				
			||||||
	"%PATH_ASSETS%css/components/conversations/windows.css",
 | 
							"%PATH_ASSETS%css/components/conversations/windows.css",
 | 
				
			||||||
	"%PATH_ASSETS%css/components/conversations/list.css",
 | 
							"%PATH_ASSETS%css/components/conversations/list.css",
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
	//User selector stylesheet
 | 
							//User selector stylesheet
 | 
				
			||||||
	"%PATH_ASSETS%css/components/userSelect/userSelect.css",
 | 
							"%PATH_ASSETS%css/components/userSelect/userSelect.css",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//Emojies
 | 
							//Emojies
 | 
				
			||||||
	"%PATH_ASSETS%css/components/emoji/parser.css",
 | 
						"%PATH_ASSETS%css/components/emoji/parser.css",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						//Pages stylesheets
 | 
				
			||||||
 | 
							//User Page
 | 
				
			||||||
 | 
							"%PATH_ASSETS%css/pages/userPage/accessForbidden.css",
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//3rd party JS files to include (at the end of the page)
 | 
					//3rd party JS files to include (at the end of the page)
 | 
				
			||||||
@@ -170,6 +174,7 @@ $config['JSfiles'] = array(
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		//User page
 | 
							//User page
 | 
				
			||||||
		"%PATH_ASSETS%js/pages/userPage/main.js",
 | 
							"%PATH_ASSETS%js/pages/userPage/main.js",
 | 
				
			||||||
 | 
							"%PATH_ASSETS%js/pages/userPage/accessForbidden.js",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		//Login page
 | 
							//Login page
 | 
				
			||||||
		"%PATH_ASSETS%js/pages/login.js",
 | 
							"%PATH_ASSETS%js/pages/login.js",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user