1(function () { 2 var getProp = function (o, name, defaultValue) { 3 return undefined === o[name] ? defaultValue : o[name]; 4 }; 5 var mainAjaxUrl = '/user/public/user/json'; 6 var SocialButton = React.createClass({displayName: "SocialButton", 7 handleClick: function (e) { 8 var self = this; 9 ajaxCall(mainAjaxUrl, { 10 action: 'social', 11 url: window.location.href, 12 notContinueProcess: true, // TODO пÑовеÑиÑÑ Ð¼Ð¾Ð¶Ð½Ð¾ ли здеÑÑ Ð±ÐµÐ·ÑÑловное -- ÐÐ 13 provider_type: this.props.type 14 }, {}, function (response) { 15 window.location.href = response.data.redirectUrl; 16 }); 17 }, 18 render: function () { 19 return React.createElement("button", { 20 className: 'btn btn-'+this.props.type+' btn-social-icon', 21 type: "button", 22 onClick: this.handleClick 23 }, 24 React.createElement("i", {className: 'fa fa-' +this.props.type}) 25 ) 26 } 27 }); 28 var UserLoginForm = React.createClass({displayName: "UserLoginForm", 29 getInitialState: function () { 30 return { 31 form: { 32 email: undefined, 33 password: undefined 34 } 35 }; 36 }, 37 handleInputChange: function (e) { 38 var form = this.state.form; 39 form[e.target.name] = e.target.value; 40 this.setState({form: form}); 41 }, 42 render: function () { 43 44 var labelEnter = 'ÐойÑи'; 45 var labelRegistration = 'РегиÑÑÑаÑиÑ'; 46 var labelEnterEmail = 'ÐведиÑе Ð²Ð°Ñ Ñл. адÑеÑ'; 47 var labelEnterPassword = 'ÐведиÑе паÑолÑ'; 48 var labelRestorePassword = 'ÐоÑÑÑановиÑÑ Ð¿Ð°ÑолÑ'; 49 50 if (typeof Yii != 'undefined') { 51 labelEnter = Yii.t( "common", "Enter" ); 52 labelRegistration = Yii.t( "common", "Sign up" ); 53 labelEnterEmail = Yii.t( "common", "Please enter your email" ); 54 labelEnterPassword = Yii.t( "common", "Enter password" ); 55 labelRestorePassword = Yii.t( "common", "Restore password" ); 56 57 } 58 59 return ( 60 React.createElement("div", {className: 'form'}, 61 React.createElement("form", null, 62 React.createElement("h3", null, this.props.getTitle(this.props, labelEnter)), 63 React.createElement("button", { 64 type: "button", 65 className: "btn btn-link absolute top right", 66 onClick: this.props.onSetTab.bind(null, 'register') 67 }, labelRegistration 68 ), 69 React.createElement("div", {className: 'form-field'}, 70 React.createElement("input", {type: "text", 71 placeholder: labelEnterEmail, 72 className: 'form-control form-field-email', 73 name: "email", 74 onChange: this.handleInputChange} 75 ) 76 ), 77 React.createElement("div", {className: 'form-field'}, 78 React.createElement("input", {type: "password", 79 placeholder: labelEnterPassword, 80 className: 'form-control form-field-password', 81 name: "password", 82 onChange: this.handleInputChange} 83 ) 84 ), 85 this.props.socialButtons, 86 React.createElement("button", {className: 'btn btn-success', 87 onClick: this.send}, this.props.getButtonTitle(this.props, labelEnter)), 88 React.createElement("button", { 89 type: "button", 90 className: "btn btn-link", 91 onClick: this.props.onSetTab.bind(null, 'remind') 92 }, labelRestorePassword 93 ) 94 ) 95 ) 96 ); 97 }, 98 send: function (e) { 99 var self = this; 100 e.preventDefault(); 101 ajaxCall(mainAjaxUrl, { 102 email: this.state.form.email, 103 password: this.state.form.password, 104 action: 'login' 105 }, {}, function (response) { 106 self.props.onSuccess(getProp(self.props, 'params', {}), response); 107 }); 108 } 109 }); 110 111 var UserRegisterForm = React.createClass({displayName: "UserRegisterForm", 112 getInitialState: function () { 113 return { 114 form: { 115 email: undefined, 116 full_name: undefined, 117 phone: undefined 118 } 119 }; 120 }, 121 handleInputChange: function (e) { 122 var form = this.state.form; 123 form[e.target.name] = e.target.value; 124 this.setState({form: form}); 125 }, 126 render: function () { 127 128 var labelRegistration = 'РегиÑÑÑаÑиÑ'; 129 var labelEnter = 'ÐÑ Ð¾Ð´'; 130 var labelEnterEmail = 'ÐведиÑе Ð²Ð°Ñ Ñл. адÑеÑ'; 131 var labelEnterFullName = 'ÐведиÑе ваÑе Ð¸Ð¼Ñ Ð¸ ÑамилиÑ'; 132 var labelEnterPhone = 'ÐведиÑе Ð²Ð°Ñ ÑелеÑон'; 133 var labelSignUp = 'ÐаÑегиÑÑÑиÑоваÑÑÑÑ'; 134 135 if (typeof Yii != 'undefined') { 136 labelRegistration = Yii.t( "common", "Registration" );
137 labelEnter = Yii.t("common", "Enter"); 138 labelEnterEmail = Yii.t( "common", "Please enter your email" ); 139 labelEnterFullName = Yii.t( "common", "Please enter your full name" ); 140 labelEnterPhone = Yii.t( "common", "Enter your phone" ); 141 labelSignUp = Yii.t( "common", "Sign up" ); 142 } 143 144 return ( 145 React.createElement("div", {className: 'form'}, 146 React.createElement("form", null, 147 React.createElement("h3", null, this.props.getTitle(this.props, labelRegistration)), 148 React.createElement("button", { 149 type: "button", 150 className: "btn btn-link absolute top right", 151 onClick: this.props.onSetTab.bind(null, 'login') 152 }, labelEnter 153 ), 154 155 React.createElement("div", {className: 'form-field'}, 156 React.createElement("input", { 157 type: "text", 158 placeholder: labelEnterEmail, 159 className: 'form-control form-field-email', 160 name: "email", 161 onChange: this.handleInputChange} 162 ) 163 ), 164 React.createElement("div", {className: 'form-field'}, 165 React.createElement("input", { 166 type: "text", 167 placeholder: labelEnterFullName, 168 className: 'form-control form-field-full_name', 169 name: "full_name", 170 onChange: this.handleInputChange} 171 ) 172 ), 173 React.createElement("div", {className: 'form-field'}, 174 React.createElement("input", { 175 type: "text", 176 placeholder: labelEnterPhone, 177 className: 'form-control form-field-phone', 178 name: "phone", 179 onChange: this.handleInputChange} 180 ) 181 ), 182 this.props.socialButtons, 183 React.createElement("button", {className: 'btn btn-success', 184 onClick: this.send}, this.props.getButtonTitle(this.props, labelSignUp)) 185 ) 186 ) 187 ); 188 }, 189 send: function (e) { 190 var self = this; 191 e.preventDefault(); 192 var params = getProp(this.props, 'params', {}); 193 var data = { 194 email: this.state.form.email, 195 full_name: this.state.form.full_name, 196 phone: this.state.form.phone, 197 action: 'register', 198 skip_user_exists: getProp(params, 'skip_user_exists', false) 199 }; 200 ajaxCall(mainAjaxUrl, data, {"enableSimpleSign":true}, function (response) { 201 self.props.onSuccess(params, response); 202 }); 203 } 204 }); 205 206 var UserRemindForm = React.createClass({displayName: "UserRemindForm", 207 getInitialState: function () { 208 return { 209 form: { 210 email: undefined 211 } 212 }; 213 }, 214 handleInputChange: function (e) { 215 var form = this.state.form; 216 form[e.target.name] = e.target.value; 217 this.setState({form: form}); 218 }, 219 render: function () { 220 221 var labelForgotPassword = 'ÐабÑли паÑолÑ?'; 222 var labelEmail = 'Ðл. адÑеÑ'; 223 var labelEnterEmail = 'ÐведиÑе Ð²Ð°Ñ Ñл. адÑеÑ'; 224 var labelSendToMail = 'ÐÑпÑавиÑÑ Ð½Ð° поÑÑÑ'; 225 var labelReturn = 'ÐеÑнÑÑÑÑÑ'; 226 227 if (typeof Yii != 'undefined') { 228 labelForgotPassword = Yii.t( "common", "Forgot password?" ); 229 labelEmail = Yii.t( "common", "Email" ); 230 labelEnterEmail = Yii.t( "common", "Please enter your email" ); 231 labelSendToMail = Yii.t( "common", "Send to mail" ); 232 labelReturn = Yii.t( "common", "Return" ); 233 } 234 235 return ( 236 React.createElement("div", {className: 'form'}, 237 React.createElement("form", null, 238 React.createElement("h3", null, this.props.getTitle(this.props, labelForgotPassword)), 239 240 React.createElement("div", {className: 'form-group'}, 241 React.createElement("label", null, labelEmail), 242 243 React.createElement("div", null, 244 React.createElement("input", { 245 type: "text", 246 placeholder: labelEnterEmail, 247 className: 'form-control', 248 name: "email", 249 onChange: this.handleInputChange} 250 ) 251 ) 252 ), 253 React.createElement("button", {className: 'btn btn-primary', 254 onClick: this.send}, this.props.getButtonTitle(this.props, labelSendToMail)), 255 256 React.createElement("button", { 257 type: "button", 258 className: "btn btn-link", 259 onClick: this.props.onSetTab.bind(null, 'login') 260 }, labelReturn 261 ) 262 ) 263 ) 264 ); 265 }, 266 send: function (e) { 267 var self = this; 268 e.preventDefault(); 269 ajaxCall(mainAjaxUrl, { 270 email: this.state.form.email, 271 action: 'remind' 272 }, {}, function (response) { 273 var params = getProp(self.props, 'params', {}); 274 params.reload = getProp(params, 'reload', false); 275 params.callback = getProp(params, 'callback', function (widget, response) { 276 widget.setTab('login'); 277 }); 278 self.props.onSuccess(params, response); 279 }); 280 } 281 }); 282 283 var UserForm = React.createClass({displayName: "UserForm", 284 getInitialState: function () { 285 var params = getProp(this.props, 'params', {}); 286 return { 287 tab: getProp(params, 'tab', 'register'), 288 show: getProp(params, 'show', true), 289 showSocialAuth: getProp(params, 'showSocialAuth', false) 290 }; 291 }, 292 _getItems: function () { 293 var self = this; 294 var params = getProp(this.props, 'params', {}); 295 var socialButtons = this.renderSocialButtons(); 296 return [ 297 { 298 id: 'login', 299 render: function () { 300 return React.createElement(UserLoginForm, { 301 onSetTab: self.setTab, 302 params: params.login, 303 onSuccess: self.handleSuccess, 304 getTitle: self.getTitle, 305 getButtonTitle: self.getButtonTitle, 306 socialButtons: socialButtons} 307 ); 308 } 309 }, 310 { 311 id: 'register', 312 render: function () { 313 return React.createElement(UserRegisterForm, { 314 onSetTab: self.setTab, 315 params: params.register, 316 onSuccess: self.handleSuccess, 317 getTitle: self.getTitle, 318 getButtonTitle: self.getButtonTitle, 319 socialButtons: socialButtons} 320 ); 321 } 322 }, 323 { 324 id: 'remind', 325 render: function () { 326 return React.createElement(UserRemindForm, { 327 onSetTab: self.setTab, 328 params: params.remind, 329 onSuccess: self.handleSuccess, 330 getTitle: self.getTitle, 331 getButtonTitle: self.getButtonTitle} 332 ); 333 } 334 } 335 ].map(function (item) { 336 var classes = []; 337 if (item.id != self.state.tab) { 338 classes.push('hide'); 339 } 340 return React.createElement("div", {className: classes.join(' ')}, item.render()); 341 }); 342 }, 343 render: function () { 344 var classes = ['gc-user-form-widget']; 345 if (!this.state.show) { 346 classes.push('hide'); 347 } 348 return ( 349 React.createElement("div", {className: classes.join(' ')}, 350 this._getItems() 351 ) 352 ); 353 }, 354 setTab: function (id, e) { 355 this.setState({ 356 tab: id 357 }); 358 e && e.preventDefault(); 359 }, 360 show: function () { 361 this.setState({show: true}); 362 }, 363 hide: function () { 364 this.setState({show: false}); 365 }, 366 toggleShow: function () { 367 this.setState({show: !this.state.show}); 368 }, 369 handleSuccess: function (params, response) { 370 if (params.callback) { 371 params.callback(this, response); 372 } 373 else { 374 getProp(params, 'reload', true) && window.location.reload(); 375 params.hash && $(document).scrollTop($('#' + params.hash).offset().top); 376 params.url && (document.location.href = params.url); 377 } 378 }, 379 getTitle: function (o, defaultVal) { 380 var params = getProp(o, 'params', {}); 381 return getProp(params, 'title', defaultVal); 382 }, 383 getButtonTitle: function (o, defaultVal) { 384 var params = getProp(o, 'params', {}); 385 return getProp(params, 'buttonTitle', defaultVal); 386 }, 387 renderSocialButtons: function () { 388 var isEnableForeignAuthMethods = window.isEnableForeignAuthMethods !== undefined 389 ? window.isEnableForeignAuthMethods 390 : true; 391 var isDisabledFacebook = window.isDisabledFacebook !== undefined 392 ? window.isDisabledFacebook 393 : false;
394 var isDisabledGooglePlus = window.isDisabledGooglePlus !== undefined 395 ? window.isDisabledGooglePlus 396 : false; 397 398 var buttons = [ 399 { 400 label: 'ÐÐонÑакÑе', 401 type: 'vk' 402 } 403 ]; 404 405 if (isEnableForeignAuthMethods && !isDisabledFacebook) { 406 buttons.unshift({ 407 label: 'Facebook', 408 type: 'facebook' 409 }); 410 } 411 412 if (isEnableForeignAuthMethods && !isDisabledGooglePlus) { 413 buttons.push({ 414 label: 'Google+', 415 type: 'google-plus' 416 }); 417 } 418 419 return this.state.showSocialAuth ? (React.createElement("div", {className: "social-buttons"}, 420 buttons.map(function (item) { 421 return React.createElement(SocialButton, {type: item.type}); 422 }) 423 )) : ''; 424 } 425 }); 426 427 var uidInit = 0; 428 429 window.UserFormFactory.registerCallback(function (el, params, callback) { 430 var id = 'gc-user-form-widget-' + (uidInit++); 431 var widget = React.render(React.createElement(UserForm, { 432 id: id, 433 params: params} 434 ), el); 435 if (callback) { 436 callback(widget); 437 } 438 }); 439})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.