@igea/oac_frontend 1.0.23 → 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@igea/oac_frontend",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "Frontend service for the OAC project",
5
5
  "main": "src/index.js",
6
+ "bin": {
7
+ "oac_frontend": "./src/index.js"
8
+ },
6
9
  "scripts": {
7
10
  "start": "cross-env NODE_ENV=production node src/index.js",
8
11
  "dev": "cross-env NODE_ENV=development nodemon src/index.js --ext js,twig",
@@ -12,21 +12,30 @@ function passwordrecoveryInit(options={}){
12
12
  });
13
13
  }
14
14
 
15
- window.onSubmitReset = function(){
16
-
17
- alert(options.labels.reset_success);
18
- window.location = "/frontend/";
19
- /*
20
- var url = "/backend/auth/password_recovery";
15
+ window.onSubmitReset = function(){
16
+ var pwd1 = document.getElementById("password").value
17
+ var pwd2 = document.getElementById("re_password").value
18
+ if(pwd1 !== pwd2){
19
+ alert(options.labels.different_password);
20
+ return;
21
+ }
22
+ if(pwd1.length < 6){
23
+ alert(options.labels.invalid_password);
24
+ return;
25
+ }
26
+ var url = "/backend/users/reset-password";
21
27
  axios.post(url, {
22
- user: document.getElementById("username").value
28
+ user: {
29
+ id: options.user,
30
+ token: options.token,
31
+ password: pwd1
32
+ }
23
33
  }).then(response => {
24
- alert(options.labels.email_sent);
34
+ alert(options.labels.reset_success);
25
35
  window.location = "/frontend/";
26
36
  }).catch(error => {
27
- console.log(error);
37
+ alert(error);
28
38
  });
29
- */
30
39
  }
31
40
 
32
41
  }
@@ -28,7 +28,9 @@
28
28
  user: {{ user.id}},
29
29
  token: "{{ user.token}}",
30
30
  labels: {
31
- reset_success: "{{ t('password_recovery.password_reset_success') }}"
31
+ reset_success: "{{ t('password_recovery.password_reset_success') }}",
32
+ different_password: "{{ t('users.edit.different_password') }}",
33
+ invalid_password: "{{ t('users.edit.invalid_password') }}"
32
34
  }
33
35
  });
34
36
  </script>