|
@@ -1,4 +1,4 @@
|
1
|
|
-/* global $ */
|
|
1
|
+/* global $, APP, JitsiMeetJS */
|
2
|
2
|
import UIUtil from "../../util/UIUtil";
|
3
|
3
|
import UIEvents from "../../../../service/UI/UIEvents";
|
4
|
4
|
import Settings from '../../../settings/Settings';
|
|
@@ -18,15 +18,15 @@ const htmlStr = `
|
18
|
18
|
<input id="setEmail" type="text" class="input-control"
|
19
|
19
|
data-i18n="[placeholder]profile.setEmailInput">
|
20
|
20
|
</div>
|
21
|
|
- <div id="authenticationContainer"
|
|
21
|
+ <div id="profile_auth_container"
|
22
|
22
|
class="sideToolbarBlock auth_container">
|
23
|
23
|
<p data-i18n="toolbar.authenticate"></p>
|
24
|
24
|
<ul>
|
25
|
|
- <li id="toolbar_auth_identity"></li>
|
26
|
|
- <li id="toolbar_button_login">
|
|
25
|
+ <li id="profile_auth_identity"></li>
|
|
26
|
+ <li id="profile_button_login">
|
27
|
27
|
<a class="authButton" data-i18n="toolbar.login"></a>
|
28
|
28
|
</li>
|
29
|
|
- <li id="toolbar_button_logout">
|
|
29
|
+ <li id="profile_button_logout">
|
30
|
30
|
<a class="authButton" data-i18n="toolbar.logout"></a>
|
31
|
31
|
</li>
|
32
|
32
|
</ul>
|
|
@@ -68,6 +68,34 @@ export default {
|
68
|
68
|
updateEmail();
|
69
|
69
|
}
|
70
|
70
|
}).focusout(updateEmail);
|
|
71
|
+
|
|
72
|
+ // LOGIN
|
|
73
|
+ function loginClicked () {
|
|
74
|
+ JitsiMeetJS.analytics.sendEvent('authenticate.login.clicked');
|
|
75
|
+ emitter.emit(UIEvents.AUTH_CLICKED);
|
|
76
|
+ }
|
|
77
|
+
|
|
78
|
+ $('#profile_button_login').click(loginClicked);
|
|
79
|
+
|
|
80
|
+ // LOGOUT
|
|
81
|
+ function logoutClicked () {
|
|
82
|
+ let titleKey = "dialog.logoutTitle";
|
|
83
|
+ let msgKey = "dialog.logoutQuestion";
|
|
84
|
+ JitsiMeetJS.analytics.sendEvent('authenticate.logout.clicked');
|
|
85
|
+ // Ask for confirmation
|
|
86
|
+ APP.UI.messageHandler.openTwoButtonDialog({
|
|
87
|
+ titleKey: titleKey,
|
|
88
|
+ msgKey: msgKey,
|
|
89
|
+ leftButtonKey: "dialog.Yes",
|
|
90
|
+ submitFunction: function (evt, yes) {
|
|
91
|
+ if (yes) {
|
|
92
|
+ emitter.emit(UIEvents.LOGOUT);
|
|
93
|
+ }
|
|
94
|
+ }
|
|
95
|
+ });
|
|
96
|
+ }
|
|
97
|
+
|
|
98
|
+ $('#profile_button_logout').click(logoutClicked);
|
71
|
99
|
},
|
72
|
100
|
|
73
|
101
|
/**
|
|
@@ -92,5 +120,46 @@ export default {
|
92
|
120
|
*/
|
93
|
121
|
changeAvatar (avatarUrl) {
|
94
|
122
|
$('#avatar').attr('src', avatarUrl);
|
|
123
|
+ },
|
|
124
|
+
|
|
125
|
+ /**
|
|
126
|
+ * Shows or hides authentication related buttons
|
|
127
|
+ * @param {boolean} show <tt>true</tt> to show or <tt>false</tt> to hide
|
|
128
|
+ */
|
|
129
|
+ showAuthenticationButtons (show) {
|
|
130
|
+ let id = 'profile_auth_container';
|
|
131
|
+ UIUtil.showOrHideElement(id, show);
|
|
132
|
+ },
|
|
133
|
+
|
|
134
|
+ /**
|
|
135
|
+ * Shows/hides login button.
|
|
136
|
+ * @param {boolean} show <tt>true</tt> to show or <tt>false</tt> to hide
|
|
137
|
+ */
|
|
138
|
+ showLoginButton (show) {
|
|
139
|
+ let id = 'profile_button_login';
|
|
140
|
+
|
|
141
|
+ UIUtil.showOrHideElement(id, show);
|
|
142
|
+ },
|
|
143
|
+
|
|
144
|
+ /**
|
|
145
|
+ * Shows/hides logout button.
|
|
146
|
+ * @param {boolean} show <tt>true</tt> to show or <tt>false</tt> to hide
|
|
147
|
+ */
|
|
148
|
+ showLogoutButton (show) {
|
|
149
|
+ let id = 'profile_button_logout';
|
|
150
|
+
|
|
151
|
+ UIUtil.showOrHideElement(id, show);
|
|
152
|
+ },
|
|
153
|
+
|
|
154
|
+ /**
|
|
155
|
+ * Displays user's authenticated identity name (login).
|
|
156
|
+ * @param {string} authIdentity identity name to be displayed.
|
|
157
|
+ */
|
|
158
|
+ setAuthenticatedIdentity (authIdentity) {
|
|
159
|
+ let id = 'profile_auth_identity';
|
|
160
|
+
|
|
161
|
+ UIUtil.showOrHideElement(id, !!authIdentity);
|
|
162
|
+
|
|
163
|
+ $(`#${id}`).text(authIdentity ? authIdentity : '');
|
95
|
164
|
}
|
96
|
165
|
};
|