Commit c7b04861 authored by Anthony Geourjon's avatar Anthony Geourjon
Browse files

Merge branch '45-amelioration-systeme-inscription' into 'master'

Resolve "Amélioration système inscription"

Closes #45

See merge request !59
parents 1efeb22c a91ba8f3
<section id="login" style="padding-top: 25px; min-height: 650px;background-color: #1E1A35">
<p class="edstore" style="padding: 50px;padding-bottom: 10px;"><img src="assets/images/WAZA_logo_blanc.png"
width="250" alt=""></p>
<div ng-show="!passwordSetOk" class="form-fields" style="width: 500px;">
<h4 class="innerB text-center"
style=" border-bottom: solid 1px; border-top: solid 1px; padding: 5px;margin-bottom: 15px;">
{{::_labels.account_activate}}.</h4>
<div class="separator clearfix"></div>
<p> {{::_labels.choose_password}}</p><br/>
<p>{{::_labels.passwordInfos}}</p><br/>
<p ng-show="errorMsg" style="font-size: 0.8em;display: initial; text-align: left; border: solid 1px white;
padding: 6px;">{{errorMsg}}</p>
<div class="separator clearfix"></div>
<div class="lock-container " style="max-width:600px;">
<form ng-submit="setPassword(password.first,password.second)">
<div>
<input type="password" ng-model="password.first" placeholder="{{::_labels.password}}"
style="width: 100%;">
<input type="password" ng-model="password.second" placeholder="{{::_labels.password2}}"
style="width: 100%;">
<button class="loginBtn" type="submit"> {{::_labels.validate}}</button>
</div>
</form>
</div>
</div>
<div ng-show="passwordSetOk" class="form-fields" style="width: 500px;">
<h4 class="innerB text-center"
style=" border-bottom: solid 1px; border-top: solid 1px; padding: 5px;margin-bottom: 15px;">
{{::_labels.account_ready}} </h4>
<a href="{{edcampusURL}}">
<button class="loginBtn" type="submit"> {{::_labels.loginBtn | uppercase}}
</button>
</a>
</div>
</section>
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
'use strict';
/* Controllers */
root.controller('UsersActivateCtrl', ['$scope', '$http', '$alertFactory', '$location', '$stateParams', 'vcRecaptchaService', '$languageFactory', '$userFactory', function ($scope, $http, $alertFactory, $location, $stateParams, vcRecaptchaService, $languageFactory, $userFactory) {
$scope.passwordSetOk = false;
$scope.edcampusURL = $scope.$parent._urls.root;
if ($languageFactory.isReady()){
activate();
}
else {
$languageFactory.onInitLang($scope, activate);
}
function activate() {
var string = $languageFactory._labels.resetInfos;
}
$scope.setPassword = function (passwdFirst, passwdSecond) {
// verify email and token parameters passed in URL.
// verify password
//TODO reset Captcha
//if(!passwdFirst || passwdFirst !== passwdSecond || $scope.responseCaptcha == "-") {
if (!passwdFirst || passwdFirst !== passwdSecond) {
$scope.errorMsg = $languageFactory._labels.alerts_requiredFieldsInvalid;
$scope._showAlert({status: 3, message: $languageFactory._labels.alerts_requiredFieldsInvalid});
return false;
}
//post to reset password
$scope._showAlert({status: 2, message: $languageFactory._labels.alerts_registration});
$scope.errorMsg = $languageFactory._labels.alerts_resetPassword;
var parameters = {"activationKey" : $stateParams.activationkey, "password" : passwdFirst};
$userFactory.setPassword(parameters, function (data) {
if (data.status == "success") {
$scope._showAlert({status: 1, message: $languageFactory._labels.alerts_registrationCode}, 5000);
$scope.errorMsg = "Activation terminée";
$scope.passwordSetOk = true;
} else {
$scope._showAlert({status: 3, message: $languageFactory._labels.alerts_resetPasswordFailure}, 5000);
$scope.errorMsg = " pas ok" ;
}
}, function (data) {
$scope._showAlert({status: 3, message: $languageFactory._labels.alerts_serverError});
$scope.errorMsg = $languageFactory._labels.alerts_serverError;
})
};
}]);
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<div class="separator clearfix"></div> <div class="separator clearfix"></div>
<button class="loginBtn" ui-sref="register" ng-show="false && currentScreen=='login'"> <button class="loginBtn" ui-sref="register" ng-show="true && currentScreen=='login'">
{{::_labels.registerTitle}} {{::_labels.registerTitle}}
</button> </button>
......
<!DOCTYPE html> <!DOCTYPE html>
<!--[if lt IE 7]> <!--[if lt IE 7]>
<html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <!--[if IE 7]>
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
if (__serverType == "PROD" || __serverType == "GCLOUD") { if (__serverType == "PROD" || __serverType == "GCLOUD") {
debug(false); debug(false);
} else debug(true); } else debug(true);
</script> </script>
......
...@@ -99,6 +99,12 @@ angular.module('myApp', [ ...@@ -99,6 +99,12 @@ angular.module('myApp', [
controller: 'UsersRegisterCtrl' controller: 'UsersRegisterCtrl'
}); });
$stateProvider.state('activate', {
url: '/activate?activationkey',
templateUrl: __root + 'components/users/activate.html',
controller: 'UsersActivateCtrl'
});
$stateProvider.state('students', {url: '/students', templateUrl: __root + 'components/users/students.html'}) $stateProvider.state('students', {url: '/students', templateUrl: __root + 'components/users/students.html'})
$stateProvider.state('reset', { $stateProvider.state('reset', {
url: '/reset?email&token', url: '/reset?email&token',
......
...@@ -549,6 +549,19 @@ function $userFactory($rootScope, $http, $serverFactory) { ...@@ -549,6 +549,19 @@ function $userFactory($rootScope, $http, $serverFactory) {
}, success, failure); }, success, failure);
} }
/**
* [resetPassword description]
* @param {[type]} parameters [description]
* @param {[type]} success [description]
* @param {[type]} failure [description]
* @return {[type]} [description]
*/
returns.setPassword = function (parameters, success, failure) {
return $serverFactory.runCommand("post_user_setPassword", parameters,
success, failure);
}
/** /**
* [quickLogin description] * [quickLogin description]
* @param {[type]} params [description] * @param {[type]} params [description]
......
...@@ -347,15 +347,15 @@ controller('CommonCtrl', ['$scope','$sce','$serverFactory','$routeParams','$root ...@@ -347,15 +347,15 @@ controller('CommonCtrl', ['$scope','$sce','$serverFactory','$routeParams','$root
$scope._checkPlan(); $scope._checkPlan();
if (current.indexOf("/register") != -1 || current.indexOf("/login") != -1 || current.indexOf("/reset") != -1) { if (current.indexOf("/register") != -1 || current.indexOf("/login") != -1 || current.indexOf("/reset") != -1 || current.indexOf("/activate") != -1) {
$scope._fullWidth = false; $scope._fullWidth = false;
} }
if (next.indexOf("/register") != -1 || next.indexOf("/login") != -1 || next.indexOf("/reset") != -1) { if (next.indexOf("/register") != -1 || next.indexOf("/login") != -1 || next.indexOf("/reset") != -1 || next.indexOf("/activate") != -1) {
$scope._fullWidth = true; $scope._fullWidth = true;
} }
if (next.indexOf("/login") != -1 && current.indexOf("/login") == -1 && current.indexOf("/reset") == -1 && current.indexOf("/register") == -1) { if (next.indexOf("/login") != -1 && current.indexOf("/login") == -1 && current.indexOf("/reset") == -1 && current.indexOf("/register") == -1 && current.indexOf("/activate") != -1) {
localStorage.savedPath = current; localStorage.savedPath = current;
} }
...@@ -882,7 +882,7 @@ controller('CommonCtrl', ['$scope','$sce','$serverFactory','$routeParams','$root ...@@ -882,7 +882,7 @@ controller('CommonCtrl', ['$scope','$sce','$serverFactory','$routeParams','$root
$scope._isLate = $utilsFactory._isLate $scope._isLate = $utilsFactory._isLate
$scope._allowDisplay = function(page){ $scope._allowDisplay = function(page){
var publicSections = ["login","register","terms","privacy","help","blog","forgot","discover","university","reset","showcase"]; var publicSections = ["login","register","terms","privacy","help","blog","forgot","discover","university","reset","showcase","activate"];
var allow = false; var allow = false;
if (!page) page = $location.path(); if (!page) page = $location.path();
...@@ -1375,7 +1375,7 @@ controller('CommonCtrl', ['$scope','$sce','$serverFactory','$routeParams','$root ...@@ -1375,7 +1375,7 @@ controller('CommonCtrl', ['$scope','$sce','$serverFactory','$routeParams','$root
$scope._pushActivity("_pageChange", {current: "null", next: $scope._getCurrentSection(), ff: WURFL.form_factor}); $scope._pushActivity("_pageChange", {current: "null", next: $scope._getCurrentSection(), ff: WURFL.form_factor});
if ($location.path() == "/login" || $location.path() == "/register" || $location.path() == "/reset") { if ($location.path() == "/login" || $location.path() == "/register" || $location.path() == "/reset" || $location.path() == "/activate") {
$scope._showLeftMenu = false; $scope._showLeftMenu = false;
} }
......
<nav class="pull-right clearfix" style="height: 50px;" ng-controller="NotificationsWindowCtrl"> <nav class="pull-right clearfix" style="height: 50px;" ng-controller="NotificationsWindowCtrl">
<!-- fake fields are a workaround for chrome autofill getting the wrong fields -->
<input style="display:none" type="text" name="fakeusernameremembered"/>
<input style="display:none" type="password" name="fakepasswordremembered"/>
<a class="pull-left logo" href="<?php echo $root ?>#" style="padding: 5px;border-radius: 2px;"> <a class="pull-left logo" href="<?php echo $root ?>#" style="padding: 5px;border-radius: 2px;">
<img src="/app/assets/images/logo-color.png" width="120" alt=""/> <img src="/app/assets/images/logo-color.png" width="120" alt=""/>
</a> </a>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment