Skip to content

Commit 9e40c5d

Browse files
committed
add userRemind pass
1 parent 5a5e5bc commit 9e40c5d

File tree

3 files changed

+47
-11
lines changed

3 files changed

+47
-11
lines changed

public/html/directives/modalLogin.html

+26-10
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,34 @@
33
<h3 class="heading-tertiary">Login</h3>
44
</div>
55
<div class="modal__body">
6-
<form id="loginForm" data-ng-submit="login()">
7-
<div class="form-group">
8-
<label for="email">E-Mail:</label>
9-
<input type="email" class="form-control" id="email" data-ng-model="email">
6+
<div class="tabs__header">
7+
<span class="tab__header" data-ng-click="setTab('login')">Login</span>
8+
<span class="tab__header" data-ng-click="setTab('remind')">Remind</span>
9+
</div>
10+
<div class="tabs__body">
11+
<div class="tab__body" data-ng-if="tab.selected === 'login'">
12+
<form id="loginForm" data-ng-submit="$parent.login()">
13+
<div class="form-group">
14+
<label for="email">E-Mail:</label>
15+
<input type="email" class="form-control" id="email" data-ng-model="$parent.email">
16+
</div>
17+
<div class="form-group">
18+
<label for="password">Password:</label>
19+
<input type="password" class="form-control" id="password" data-ng-model="$parent.password">
20+
</div>
21+
</form>
22+
<div data-ng-if="$parent.errorActive">This account is not activated.</div>
23+
<div data-ng-if="$parent.errorPass">No account associated with this email or wrong password.</div>
1024
</div>
11-
<div class="form-group">
12-
<label for="password">Password:</label>
13-
<input type="password" class="form-control" id="password" data-ng-model="password">
25+
<div class="tab__body" data-ng-if="tab.selected === 'remind'">
26+
<form id="remindForm" data-ng-submit="$parent.remind()">
27+
<div class="form-group">
28+
<label for="emailRemind">E-Mail:</label>
29+
<input type="email" class="form-control" id="emailRemind" data-ng-model="$parent.email">
30+
</div>
31+
</form>
1432
</div>
15-
</form>
16-
<div data-ng-if="errorActive">This account is not activated.</div>
17-
<div data-ng-if="errorPass">No account associated with this email or wrong password.</div>
33+
</div>
1834
</div>
1935
<div class="modal__footer">
2036
<button type="submit" class="button" form="loginForm">Login</button>

public/js/directives/modalLogin.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
$scope.success = false;
1818
$scope.errorPass = false;
1919
$scope.errorActive = false;
20+
$scope.errorRemind = false;
2021

2122
$scope.hideModal = () => stateService.set('modalLogin', false);
2223
$scope.login = async () => {
@@ -25,10 +26,18 @@
2526
if(response.status === 403) $scope.errorActive = true;
2627
if(response.status === 401) $scope.errorPass = true;
2728
if(response.status === 200) {
28-
$scope.success = true;
2929
stateService.set('modalLogin', false);
3030
$scope.$apply();
3131
}
32+
};
33+
$scope.remind = async () => {
34+
const params = { email: $scope.email };
35+
const response = await authService.remind(params);
36+
if(response.status === 200) {
37+
$scope.success = true
38+
} else {
39+
$scope.errorRemind = true;
40+
}
3241
}
3342
}
3443
}

public/js/services/authService.js

+11
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,16 @@
3232
$localForage.clear()
3333
.then(() => { $rootScope.$emit('user::auth') });
3434
};
35+
36+
this.remind = (params) => {
37+
return $http({
38+
url: httpConfig.baseUrl + '/user/remind',
39+
headers: { 'Content-Type': 'application/json' },
40+
method: 'POST',
41+
data: params
42+
})
43+
.then(response => { return response })
44+
.catch(err => { return err });
45+
}
3546
}
3647
})();

0 commit comments

Comments
 (0)