diff options
author | Jacek Antonelli | 2008-08-15 23:45:27 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:27 -0500 |
commit | a8a62201ba762e98dff92cf49033e577fc34d8d4 (patch) | |
tree | 11f8513c5cdc222f2fac0c93eb724c089803c200 /linden/indra/newview/llpanellogin.cpp | |
parent | Second Life viewer sources 1.18.6.4-RC (diff) | |
download | meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.zip meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.gz meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.bz2 meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.xz |
Second Life viewer sources 1.19.0.0
Diffstat (limited to 'linden/indra/newview/llpanellogin.cpp')
-rw-r--r-- | linden/indra/newview/llpanellogin.cpp | 481 |
1 files changed, 455 insertions, 26 deletions
diff --git a/linden/indra/newview/llpanellogin.cpp b/linden/indra/newview/llpanellogin.cpp index d0f2041..6029c2f 100644 --- a/linden/indra/newview/llpanellogin.cpp +++ b/linden/indra/newview/llpanellogin.cpp | |||
@@ -12,12 +12,12 @@ | |||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | 12 | * ("GPL"), unless you have obtained a separate licensing agreement |
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | 13 | * ("Other License"), formally executed by you and Linden Lab. Terms of |
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | 14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or |
15 | * online at http://secondlife.com/developers/opensource/gplv2 | 15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 |
16 | * | 16 | * |
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlife.com/developers/opensource/flossexception | 20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception |
21 | * | 21 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 22 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 23 | * that you have read and understood your obligations described above, |
@@ -38,7 +38,6 @@ | |||
38 | #include "llfontgl.h" | 38 | #include "llfontgl.h" |
39 | #include "llmd5.h" | 39 | #include "llmd5.h" |
40 | #include "llsecondlifeurls.h" | 40 | #include "llsecondlifeurls.h" |
41 | #include "llwindow.h" // shell_open() | ||
42 | #include "llversionviewer.h" | 41 | #include "llversionviewer.h" |
43 | #include "v4color.h" | 42 | #include "v4color.h" |
44 | 43 | ||
@@ -71,11 +70,13 @@ | |||
71 | #include "llweb.h" | 70 | #include "llweb.h" |
72 | #include "llwebbrowserctrl.h" | 71 | #include "llwebbrowserctrl.h" |
73 | 72 | ||
74 | #include "llfloaterhtmlhelp.h" | 73 | #include "llfloaterhtml.h" |
74 | //#include "llfloaterhtmlhelp.h" | ||
75 | #include "llfloatertos.h" | 75 | #include "llfloatertos.h" |
76 | 76 | ||
77 | #include "llglheaders.h" | 77 | #include "llglheaders.h" |
78 | 78 | ||
79 | #define USE_VIEWER_AUTH 0 | ||
79 | 80 | ||
80 | LLString load_password_from_disk(void); | 81 | LLString load_password_from_disk(void); |
81 | void save_password_to_disk(const char* hashed_password); | 82 | void save_password_to_disk(const char* hashed_password); |
@@ -84,12 +85,14 @@ const S32 BLACK_BORDER_HEIGHT = 160; | |||
84 | const S32 MAX_PASSWORD = 16; | 85 | const S32 MAX_PASSWORD = 16; |
85 | 86 | ||
86 | LLPanelLogin *LLPanelLogin::sInstance = NULL; | 87 | LLPanelLogin *LLPanelLogin::sInstance = NULL; |
88 | BOOL LLPanelLogin::sCapslockDidNotification = FALSE; | ||
87 | 89 | ||
88 | 90 | ||
89 | class LLLoginRefreshHandler : public LLCommandHandler | 91 | class LLLoginRefreshHandler : public LLCommandHandler |
90 | { | 92 | { |
91 | public: | 93 | public: |
92 | LLLoginRefreshHandler() : LLCommandHandler("login_refresh") { } | 94 | // don't allow from external browsers |
95 | LLLoginRefreshHandler() : LLCommandHandler("login_refresh", false) { } | ||
93 | bool handle(const LLSD& tokens, const LLSD& queryMap) | 96 | bool handle(const LLSD& tokens, const LLSD& queryMap) |
94 | { | 97 | { |
95 | #if LL_LIBXUL_ENABLED | 98 | #if LL_LIBXUL_ENABLED |
@@ -351,15 +354,97 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, | |||
351 | 354 | ||
352 | gUICtrlFactory->buildPanel(this, "panel_login.xml"); | 355 | gUICtrlFactory->buildPanel(this, "panel_login.xml"); |
353 | 356 | ||
357 | #if USE_VIEWER_AUTH | ||
354 | //leave room for the login menu bar | 358 | //leave room for the login menu bar |
355 | setRect(LLRect(0, rect.getHeight()-18, rect.getWidth(), 0)); | 359 | setRect(LLRect(0, rect.getHeight()-18, rect.getWidth(), 0)); |
360 | #endif | ||
356 | reshape(rect.getWidth(), rect.getHeight()); | 361 | reshape(rect.getWidth(), rect.getHeight()); |
362 | |||
363 | #if !USE_VIEWER_AUTH | ||
364 | childSetPrevalidate("first_name_edit", LLLineEditor::prevalidatePrintableNoSpace); | ||
365 | childSetPrevalidate("last_name_edit", LLLineEditor::prevalidatePrintableNoSpace); | ||
366 | |||
367 | childSetCommitCallback("password_edit", mungePassword); | ||
368 | childSetKeystrokeCallback("password_edit", onPassKey, this); | ||
369 | childSetUserData("password_edit", this); | ||
370 | |||
371 | LLLineEditor* edit = LLUICtrlFactory::getLineEditorByName(this, "password_edit"); | ||
372 | if (edit) edit->setDrawAsterixes(TRUE); | ||
373 | |||
374 | LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(this, "start_location_combo"); | ||
375 | if (combo) | ||
376 | { | ||
377 | combo->setAllowTextEntry(TRUE, 128, FALSE); | ||
378 | |||
379 | // The XML file loads the combo with the following labels: | ||
380 | // 0 - "My Home" | ||
381 | // 1 - "My Last Location" | ||
382 | // 2 - "<Type region name>" | ||
383 | |||
384 | BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); | ||
385 | LLString sim_string = LLURLSimString::sInstance.mSimString; | ||
386 | if (!sim_string.empty()) | ||
387 | { | ||
388 | // Replace "<Type region name>" with this region name | ||
389 | combo->remove(2); | ||
390 | combo->add( sim_string ); | ||
391 | combo->setTextEntry(sim_string); | ||
392 | combo->setCurrentByIndex( 2 ); | ||
393 | } | ||
394 | else if (login_last) | ||
395 | { | ||
396 | combo->setCurrentByIndex( 1 ); | ||
397 | } | ||
398 | else | ||
399 | { | ||
400 | combo->setCurrentByIndex( 0 ); | ||
401 | } | ||
402 | |||
403 | combo->setCommitCallback( &LLPanelGeneral::set_start_location ); | ||
404 | } | ||
405 | |||
406 | childSetAction("connect_btn", onClickConnect, this); | ||
407 | |||
408 | setDefaultBtn("connect_btn"); | ||
409 | |||
410 | childSetAction("quit_btn", onClickQuit, this); | ||
411 | |||
412 | LLTextBox* version_text = LLUICtrlFactory::getTextBoxByName(this, "version_text"); | ||
413 | if (version_text) | ||
414 | { | ||
415 | LLString version = llformat("%d.%d.%d (%d)", | ||
416 | LL_VERSION_MAJOR, | ||
417 | LL_VERSION_MINOR, | ||
418 | LL_VERSION_PATCH, | ||
419 | LL_VIEWER_BUILD ); | ||
420 | version_text->setText(version); | ||
421 | version_text->setClickedCallback(onClickVersion); | ||
422 | version_text->setCallbackUserData(this); | ||
423 | } | ||
424 | |||
425 | LLTextBox* channel_text = LLUICtrlFactory::getTextBoxByName(this, "channel_text"); | ||
426 | if (channel_text) | ||
427 | { | ||
428 | channel_text->setText(gChannelName); | ||
429 | channel_text->setClickedCallback(onClickVersion); | ||
430 | channel_text->setCallbackUserData(this); | ||
431 | } | ||
432 | |||
433 | LLTextBox* forgot_password_text = LLUICtrlFactory::getTextBoxByName(this, "forgot_password_text"); | ||
434 | if (forgot_password_text) | ||
435 | { | ||
436 | forgot_password_text->setClickedCallback(onClickForgotPassword); | ||
437 | } | ||
438 | #endif | ||
357 | 439 | ||
358 | // get the web browser control | 440 | // get the web browser control |
359 | #if LL_LIBXUL_ENABLED | 441 | #if LL_LIBXUL_ENABLED |
360 | LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(this, "login_html"); | 442 | LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(this, "login_html"); |
361 | if ( web_browser ) | 443 | if ( web_browser ) |
362 | { | 444 | { |
445 | // Need to handle login secondlife:///app/ URLs | ||
446 | web_browser->setOpenAppSLURLs( true ); | ||
447 | |||
363 | // observe browser events | 448 | // observe browser events |
364 | web_browser->addObserver( this ); | 449 | web_browser->addObserver( this ); |
365 | 450 | ||
@@ -372,11 +457,15 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, | |||
372 | 457 | ||
373 | // force the size to be correct (XML doesn't seem to be sufficient to do this) (with some padding so the other login screen doesn't show through) | 458 | // force the size to be correct (XML doesn't seem to be sufficient to do this) (with some padding so the other login screen doesn't show through) |
374 | LLRect htmlRect = mRect; | 459 | LLRect htmlRect = mRect; |
460 | #if USE_VIEWER_AUTH | ||
375 | htmlRect.setCenterAndSize( mRect.getCenterX() - 2, mRect.getCenterY(), mRect.getWidth() + 6, mRect.getHeight()); | 461 | htmlRect.setCenterAndSize( mRect.getCenterX() - 2, mRect.getCenterY(), mRect.getWidth() + 6, mRect.getHeight()); |
462 | #else | ||
463 | htmlRect.setCenterAndSize( mRect.getCenterX() - 2, mRect.getCenterY() + 40, mRect.getWidth() + 6, mRect.getHeight() - 78 ); | ||
464 | #endif | ||
376 | web_browser->setRect( htmlRect ); | 465 | web_browser->setRect( htmlRect ); |
377 | web_browser->reshape( htmlRect.getWidth(), htmlRect.getHeight(), TRUE ); | 466 | web_browser->reshape( htmlRect.getWidth(), htmlRect.getHeight(), TRUE ); |
378 | reshape( mRect.getWidth(), mRect.getHeight(), 1 ); | 467 | reshape( mRect.getWidth(), mRect.getHeight(), 1 ); |
379 | 468 | ||
380 | // kick off a request to grab the url manually | 469 | // kick off a request to grab the url manually |
381 | gResponsePtr = LLIamHereLogin::build( this ); | 470 | gResponsePtr = LLIamHereLogin::build( this ); |
382 | std::string login_page = LLAppViewer::instance()->getLoginPage(); | 471 | std::string login_page = LLAppViewer::instance()->getLoginPage(); |
@@ -390,7 +479,10 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, | |||
390 | mHtmlAvailable = FALSE; | 479 | mHtmlAvailable = FALSE; |
391 | #endif | 480 | #endif |
392 | 481 | ||
482 | #if !USE_VIEWER_AUTH | ||
393 | // Initialize visibility (and don't force visibility - use prefs) | 483 | // Initialize visibility (and don't force visibility - use prefs) |
484 | refreshLocation( false ); | ||
485 | #endif | ||
394 | } | 486 | } |
395 | 487 | ||
396 | void LLPanelLogin::setSiteIsAlive( bool alive ) | 488 | void LLPanelLogin::setSiteIsAlive( bool alive ) |
@@ -411,6 +503,17 @@ void LLPanelLogin::setSiteIsAlive( bool alive ) | |||
411 | else | 503 | else |
412 | // the site is not available (missing page, server down, other badness) | 504 | // the site is not available (missing page, server down, other badness) |
413 | { | 505 | { |
506 | #if !USE_VIEWER_AUTH | ||
507 | if ( web_browser ) | ||
508 | { | ||
509 | // hide browser control (revealing default one) | ||
510 | web_browser->setVisible( FALSE ); | ||
511 | |||
512 | // mark as unavailable | ||
513 | mHtmlAvailable = FALSE; | ||
514 | } | ||
515 | #else | ||
516 | |||
414 | if ( web_browser ) | 517 | if ( web_browser ) |
415 | { | 518 | { |
416 | web_browser->navigateToLocalPage( "loading-error" , "index.html" ); | 519 | web_browser->navigateToLocalPage( "loading-error" , "index.html" ); |
@@ -418,12 +521,29 @@ void LLPanelLogin::setSiteIsAlive( bool alive ) | |||
418 | // mark as available | 521 | // mark as available |
419 | mHtmlAvailable = TRUE; | 522 | mHtmlAvailable = TRUE; |
420 | } | 523 | } |
524 | #endif | ||
421 | } | 525 | } |
526 | |||
422 | #else | 527 | #else |
423 | mHtmlAvailable = FALSE; | 528 | mHtmlAvailable = FALSE; |
424 | #endif | 529 | #endif |
425 | } | 530 | } |
426 | 531 | ||
532 | void LLPanelLogin::mungePassword(LLUICtrl* caller, void* user_data) | ||
533 | { | ||
534 | LLPanelLogin* self = (LLPanelLogin*)user_data; | ||
535 | LLLineEditor* editor = (LLLineEditor*)caller; | ||
536 | std::string password = editor->getText(); | ||
537 | |||
538 | // Re-md5 if we've changed at all | ||
539 | if (password != self->mIncomingPassword) | ||
540 | { | ||
541 | LLMD5 pass((unsigned char *)password.c_str()); | ||
542 | char munged_password[MD5HEX_STR_SIZE]; | ||
543 | pass.hex_digest(munged_password); | ||
544 | self->mMungedPassword = munged_password; | ||
545 | } | ||
546 | } | ||
427 | 547 | ||
428 | LLPanelLogin::~LLPanelLogin() | 548 | LLPanelLogin::~LLPanelLogin() |
429 | { | 549 | { |
@@ -458,8 +578,12 @@ void LLPanelLogin::draw() | |||
458 | 578 | ||
459 | if ( mHtmlAvailable ) | 579 | if ( mHtmlAvailable ) |
460 | { | 580 | { |
581 | #if !USE_VIEWER_AUTH | ||
461 | // draw a background box in black | 582 | // draw a background box in black |
462 | gl_rect_2d( 0, height - 264, width, 264, LLColor4( 0.0f, 0.0f, 0.0f, 1.f ) ); | 583 | gl_rect_2d( 0, height - 264, width, 264, LLColor4( 0.0f, 0.0f, 0.0f, 1.f ) ); |
584 | // draw the bottom part of the background image - just the blue background to the native client UI | ||
585 | gl_draw_scaled_image(0, -264, width + 8, mLogoImage->getHeight(), mLogoImage); | ||
586 | #endif | ||
463 | } | 587 | } |
464 | else | 588 | else |
465 | { | 589 | { |
@@ -527,14 +651,61 @@ BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) | |||
527 | 651 | ||
528 | return LLPanel::handleKeyHere(key, mask, called_from_parent); | 652 | return LLPanel::handleKeyHere(key, mask, called_from_parent); |
529 | } | 653 | } |
530 | 654 | ||
655 | // virtual | ||
656 | void LLPanelLogin::setFocus(BOOL b) | ||
657 | { | ||
658 | if(b != hasFocus()) | ||
659 | { | ||
660 | if(b) | ||
661 | { | ||
662 | LLPanelLogin::giveFocus(); | ||
663 | } | ||
664 | else | ||
665 | { | ||
666 | LLPanel::setFocus(b); | ||
667 | } | ||
668 | } | ||
669 | } | ||
531 | 670 | ||
532 | // static | 671 | // static |
533 | void LLPanelLogin::giveFocus() | 672 | void LLPanelLogin::giveFocus() |
534 | { | 673 | { |
535 | 674 | #if USE_VIEWER_AUTH | |
536 | if (sInstance) | 675 | if (sInstance) |
676 | { | ||
537 | sInstance->setFocus(TRUE); | 677 | sInstance->setFocus(TRUE); |
678 | } | ||
679 | #else | ||
680 | if( sInstance ) | ||
681 | { | ||
682 | // Grab focus and move cursor to first blank input field | ||
683 | std::string first = sInstance->childGetText("first_name_edit"); | ||
684 | std::string pass = sInstance->childGetText("password_edit"); | ||
685 | |||
686 | BOOL have_first = !first.empty(); | ||
687 | BOOL have_pass = !pass.empty(); | ||
688 | |||
689 | LLLineEditor* edit = NULL; | ||
690 | if (have_first && !have_pass) | ||
691 | { | ||
692 | // User saved his name but not his password. Move | ||
693 | // focus to password field. | ||
694 | edit = LLUICtrlFactory::getLineEditorByName(sInstance, "password_edit"); | ||
695 | } | ||
696 | else | ||
697 | { | ||
698 | // User doesn't have a name, so start there. | ||
699 | edit = LLUICtrlFactory::getLineEditorByName(sInstance, "first_name_edit"); | ||
700 | } | ||
701 | |||
702 | if (edit) | ||
703 | { | ||
704 | edit->setFocus(TRUE); | ||
705 | edit->selectAll(); | ||
706 | } | ||
707 | } | ||
708 | #endif | ||
538 | } | 709 | } |
539 | 710 | ||
540 | 711 | ||
@@ -546,24 +717,188 @@ void LLPanelLogin::show(const LLRect &rect, | |||
546 | { | 717 | { |
547 | new LLPanelLogin(rect, show_server, callback, callback_data); | 718 | new LLPanelLogin(rect, show_server, callback, callback_data); |
548 | 719 | ||
549 | #if LL_LIBXUL_ENABLED | ||
550 | LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(sInstance, "login_html"); | ||
551 | |||
552 | if (!web_browser) return; | ||
553 | |||
554 | if( !gFocusMgr.getKeyboardFocus() ) | 720 | if( !gFocusMgr.getKeyboardFocus() ) |
555 | { | 721 | { |
556 | // Grab focus and move cursor to first enabled control | 722 | // Grab focus and move cursor to first enabled control |
557 | web_browser->setFocus(TRUE); | 723 | sInstance->setFocus(TRUE); |
558 | } | 724 | } |
559 | 725 | ||
560 | // Make sure that focus always goes here (and use the latest sInstance that was just created) | 726 | // Make sure that focus always goes here (and use the latest sInstance that was just created) |
561 | gFocusMgr.setDefaultKeyboardFocus(web_browser); | 727 | gFocusMgr.setDefaultKeyboardFocus(sInstance); |
562 | #endif | 728 | } |
729 | |||
730 | // static | ||
731 | void LLPanelLogin::setFields(const std::string& firstname, const std::string& lastname, const std::string& password, | ||
732 | BOOL remember) | ||
733 | { | ||
734 | if (!sInstance) | ||
735 | { | ||
736 | llwarns << "Attempted fillFields with no login view shown" << llendl; | ||
737 | return; | ||
738 | } | ||
739 | |||
740 | sInstance->childSetText("first_name_edit", firstname); | ||
741 | sInstance->childSetText("last_name_edit", lastname); | ||
742 | |||
743 | // Max "actual" password length is 16 characters. | ||
744 | // Hex digests are always 32 characters. | ||
745 | if (password.length() == 32) | ||
746 | { | ||
747 | // This is a MD5 hex digest of a password. | ||
748 | // We don't actually use the password input field, | ||
749 | // fill it with MAX_PASSWORD characters so we get a | ||
750 | // nice row of asterixes. | ||
751 | const std::string filler("123456789!123456"); | ||
752 | sInstance->childSetText("password_edit", filler); | ||
753 | sInstance->mIncomingPassword = filler; | ||
754 | sInstance->mMungedPassword = password; | ||
755 | } | ||
756 | else | ||
757 | { | ||
758 | // this is a normal text password | ||
759 | sInstance->childSetText("password_edit", password); | ||
760 | sInstance->mIncomingPassword = password; | ||
761 | LLMD5 pass((unsigned char *)password.c_str()); | ||
762 | char munged_password[MD5HEX_STR_SIZE]; | ||
763 | pass.hex_digest(munged_password); | ||
764 | sInstance->mMungedPassword = munged_password; | ||
765 | } | ||
766 | |||
767 | sInstance->childSetValue("remember_check", remember); | ||
563 | } | 768 | } |
564 | 769 | ||
565 | 770 | ||
566 | // static | 771 | // static |
772 | void LLPanelLogin::addServer(const char *server, S32 domain_name) | ||
773 | { | ||
774 | if (!sInstance) | ||
775 | { | ||
776 | llwarns << "Attempted addServer with no login view shown" << llendl; | ||
777 | return; | ||
778 | } | ||
779 | |||
780 | LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "server_combo"); | ||
781 | if (combo) | ||
782 | { | ||
783 | combo->add(server, LLSD(domain_name) ); | ||
784 | combo->setCurrentByIndex(0); | ||
785 | } | ||
786 | } | ||
787 | |||
788 | // static | ||
789 | void LLPanelLogin::getFields(LLString &firstname, LLString &lastname, LLString &password, | ||
790 | BOOL &remember) | ||
791 | { | ||
792 | if (!sInstance) | ||
793 | { | ||
794 | llwarns << "Attempted getFields with no login view shown" << llendl; | ||
795 | return; | ||
796 | } | ||
797 | |||
798 | firstname = sInstance->childGetText("first_name_edit"); | ||
799 | LLString::trim(firstname); | ||
800 | |||
801 | lastname = sInstance->childGetText("last_name_edit"); | ||
802 | LLString::trim(lastname); | ||
803 | |||
804 | password = sInstance->mMungedPassword; | ||
805 | remember = sInstance->childGetValue("remember_check"); | ||
806 | } | ||
807 | |||
808 | |||
809 | // static. Return TRUE if user made a choice from the popup | ||
810 | BOOL LLPanelLogin::getServer(LLString &server, S32 &domain_name) | ||
811 | { | ||
812 | BOOL user_picked = FALSE; | ||
813 | if (!sInstance) | ||
814 | { | ||
815 | llwarns << "Attempted getServer with no login view shown" << llendl; | ||
816 | } | ||
817 | else | ||
818 | { | ||
819 | LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "server_combo"); | ||
820 | if (combo) | ||
821 | { | ||
822 | LLSD combo_val = combo->getValue(); | ||
823 | if (LLSD::TypeInteger == combo_val.type()) | ||
824 | { | ||
825 | domain_name = combo->getValue().asInteger(); | ||
826 | |||
827 | if ((S32)GRID_INFO_OTHER == domain_name) | ||
828 | { | ||
829 | server = gGridName; | ||
830 | } | ||
831 | } | ||
832 | else | ||
833 | { | ||
834 | // no valid selection, return other | ||
835 | domain_name = (S32)GRID_INFO_OTHER; | ||
836 | server = combo_val.asString(); | ||
837 | } | ||
838 | user_picked = combo->isDirty(); | ||
839 | } | ||
840 | } | ||
841 | |||
842 | return user_picked; | ||
843 | } | ||
844 | |||
845 | // static | ||
846 | void LLPanelLogin::getLocation(LLString &location) | ||
847 | { | ||
848 | if (!sInstance) | ||
849 | { | ||
850 | llwarns << "Attempted getLocation with no login view shown" << llendl; | ||
851 | return; | ||
852 | } | ||
853 | |||
854 | LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "start_location_combo"); | ||
855 | if (combo) | ||
856 | { | ||
857 | location = combo->getValue().asString(); | ||
858 | } | ||
859 | } | ||
860 | |||
861 | // static | ||
862 | void LLPanelLogin::refreshLocation( bool force_visible ) | ||
863 | { | ||
864 | if (!sInstance) return; | ||
865 | |||
866 | #if USE_VIEWER_AUTH | ||
867 | loadLoginPage(); | ||
868 | #else | ||
869 | LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "start_location_combo"); | ||
870 | if (!combo) return; | ||
871 | |||
872 | if (LLURLSimString::parse()) | ||
873 | { | ||
874 | combo->setCurrentByIndex( 3 ); // BUG? Maybe 2? | ||
875 | combo->setTextEntry(LLURLSimString::sInstance.mSimString); | ||
876 | } | ||
877 | else | ||
878 | { | ||
879 | BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); | ||
880 | combo->setCurrentByIndex( login_last ? 1 : 0 ); | ||
881 | } | ||
882 | |||
883 | BOOL show_start = TRUE; | ||
884 | |||
885 | if ( ! force_visible ) | ||
886 | show_start = gSavedSettings.getBOOL("ShowStartLocation"); | ||
887 | |||
888 | sInstance->childSetVisible("start_location_combo", show_start); | ||
889 | sInstance->childSetVisible("start_location_text", show_start); | ||
890 | |||
891 | #if LL_RELEASE_FOR_DOWNLOAD | ||
892 | BOOL show_server = gSavedSettings.getBOOL("ForceShowGrid"); | ||
893 | sInstance->childSetVisible("server_combo", show_server); | ||
894 | #else | ||
895 | sInstance->childSetVisible("server_combo", TRUE); | ||
896 | #endif | ||
897 | |||
898 | #endif | ||
899 | } | ||
900 | |||
901 | // static | ||
567 | void LLPanelLogin::close() | 902 | void LLPanelLogin::close() |
568 | { | 903 | { |
569 | if (sInstance) | 904 | if (sInstance) |
@@ -597,11 +932,19 @@ void LLPanelLogin::setAlwaysRefresh(bool refresh) | |||
597 | void LLPanelLogin::loadLoginPage() | 932 | void LLPanelLogin::loadLoginPage() |
598 | { | 933 | { |
599 | if (!sInstance) return; | 934 | if (!sInstance) return; |
935 | |||
936 | std::ostringstream oStr; | ||
600 | 937 | ||
938 | std::string login_page = LLAppViewer::instance()->getLoginPage(); | ||
939 | if (login_page.empty()) | ||
940 | { | ||
941 | login_page = sInstance->childGetValue( "real_url" ).asString(); | ||
942 | } | ||
943 | oStr << login_page; | ||
944 | |||
945 | #if USE_VIEWER_AUTH | ||
601 | LLURLSimString::sInstance.parse(); | 946 | LLURLSimString::sInstance.parse(); |
602 | 947 | ||
603 | std::ostringstream oStr; | ||
604 | |||
605 | LLString location; | 948 | LLString location; |
606 | LLString region; | 949 | LLString region; |
607 | LLString password; | 950 | LLString password; |
@@ -654,11 +997,6 @@ void LLPanelLogin::loadLoginPage() | |||
654 | char* curl_channel = curl_escape(gChannelName.c_str(), 0); | 997 | char* curl_channel = curl_escape(gChannelName.c_str(), 0); |
655 | char* curl_version = curl_escape(version.c_str(), 0); | 998 | char* curl_version = curl_escape(version.c_str(), 0); |
656 | 999 | ||
657 | std::string login_page = LLAppViewer::instance()->getLoginPage(); | ||
658 | if (login_page.empty()) | ||
659 | { | ||
660 | login_page = sInstance->childGetValue( "real_url" ).asString(); | ||
661 | } | ||
662 | 1000 | ||
663 | // Use the right delimeter depending on how LLURI parses the URL | 1001 | // Use the right delimeter depending on how LLURI parses the URL |
664 | LLURI login_page_uri = LLURI(login_page); | 1002 | LLURI login_page_uri = LLURI(login_page); |
@@ -667,7 +1005,7 @@ void LLPanelLogin::loadLoginPage() | |||
667 | { | 1005 | { |
668 | first_query_delimiter = "?"; | 1006 | first_query_delimiter = "?"; |
669 | } | 1007 | } |
670 | oStr << login_page << first_query_delimiter << "firstname=" << firstname << | 1008 | oStr << first_query_delimiter << "firstname=" << firstname << |
671 | "&lastname=" << lastname << "&location=" << location << "®ion=" << curl_region << | 1009 | "&lastname=" << lastname << "&location=" << location << "®ion=" << curl_region << |
672 | "&grid=" << gGridInfo[gGridChoice].mLabel << "&channel=" << curl_channel << | 1010 | "&grid=" << gGridInfo[gGridChoice].mLabel << "&channel=" << curl_channel << |
673 | "&version=" << curl_version; | 1011 | "&version=" << curl_version; |
@@ -676,7 +1014,7 @@ void LLPanelLogin::loadLoginPage() | |||
676 | curl_free(curl_channel); | 1014 | curl_free(curl_channel); |
677 | curl_free(curl_version); | 1015 | curl_free(curl_version); |
678 | 1016 | ||
679 | LLString language(gSavedSettings.getString("Language")); | 1017 | LLString language(gSavedSettings.getString("Language")); |
680 | if(language == "default") | 1018 | if(language == "default") |
681 | { | 1019 | { |
682 | language = gSavedSettings.getString("SystemLanguage"); | 1020 | language = gSavedSettings.getString("SystemLanguage"); |
@@ -710,6 +1048,7 @@ void LLPanelLogin::loadLoginPage() | |||
710 | if (gSavedSettings.getBOOL("ForceShowGrid")) | 1048 | if (gSavedSettings.getBOOL("ForceShowGrid")) |
711 | oStr << "&show_grid=TRUE"; | 1049 | oStr << "&show_grid=TRUE"; |
712 | #endif | 1050 | #endif |
1051 | #endif | ||
713 | 1052 | ||
714 | #if LL_LIBXUL_ENABLED | 1053 | #if LL_LIBXUL_ENABLED |
715 | LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(sInstance, "login_html"); | 1054 | LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(sInstance, "login_html"); |
@@ -742,6 +1081,77 @@ void LLPanelLogin::onNavigateComplete( const EventType& eventIn ) | |||
742 | //--------------------------------------------------------------------------- | 1081 | //--------------------------------------------------------------------------- |
743 | 1082 | ||
744 | // static | 1083 | // static |
1084 | void LLPanelLogin::onClickConnect(void *) | ||
1085 | { | ||
1086 | if (sInstance && sInstance->mCallback) | ||
1087 | { | ||
1088 | // tell the responder we're not here anymore | ||
1089 | if ( gResponsePtr ) | ||
1090 | gResponsePtr->setParent( 0 ); | ||
1091 | |||
1092 | // JC - Make sure the fields all get committed. | ||
1093 | sInstance->setFocus(FALSE); | ||
1094 | |||
1095 | LLString first = sInstance->childGetText("first_name_edit"); | ||
1096 | LLString last = sInstance->childGetText("last_name_edit"); | ||
1097 | if (!first.empty() && !last.empty()) | ||
1098 | { | ||
1099 | // has both first and last name typed | ||
1100 | |||
1101 | // store off custom server entry, if currently selected | ||
1102 | LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "server_combo"); | ||
1103 | if (combo) | ||
1104 | { | ||
1105 | S32 selected_server = combo->getValue(); | ||
1106 | if (selected_server == GRID_INFO_NONE) | ||
1107 | { | ||
1108 | LLString custom_server = combo->getValue().asString(); | ||
1109 | gSavedSettings.setString("CustomServer", custom_server); | ||
1110 | } | ||
1111 | } | ||
1112 | sInstance->mCallback(0, sInstance->mCallbackData); | ||
1113 | } | ||
1114 | else | ||
1115 | { | ||
1116 | // empty first or last name | ||
1117 | // same as clicking new account | ||
1118 | onClickNewAccount(NULL); | ||
1119 | } | ||
1120 | } | ||
1121 | } | ||
1122 | |||
1123 | |||
1124 | // static | ||
1125 | void LLPanelLogin::newAccountAlertCallback(S32 option, void*) | ||
1126 | { | ||
1127 | if (0 == option) | ||
1128 | { | ||
1129 | llinfos << "Going to account creation URL" << llendl; | ||
1130 | LLWeb::loadURL( CREATE_ACCOUNT_URL ); | ||
1131 | } | ||
1132 | else | ||
1133 | { | ||
1134 | sInstance->setFocus(TRUE); | ||
1135 | } | ||
1136 | } | ||
1137 | |||
1138 | |||
1139 | // static | ||
1140 | void LLPanelLogin::onClickNewAccount(void*) | ||
1141 | { | ||
1142 | if (gHideLinks) | ||
1143 | { | ||
1144 | gViewerWindow->alertXml("MustHaveAccountToLogInNoLinks"); | ||
1145 | } | ||
1146 | else | ||
1147 | { | ||
1148 | gViewerWindow->alertXml("MustHaveAccountToLogIn", | ||
1149 | LLPanelLogin::newAccountAlertCallback); | ||
1150 | } | ||
1151 | } | ||
1152 | |||
1153 | |||
1154 | // static | ||
745 | void LLPanelLogin::onClickQuit(void*) | 1155 | void LLPanelLogin::onClickQuit(void*) |
746 | { | 1156 | { |
747 | if (sInstance && sInstance->mCallback) | 1157 | if (sInstance && sInstance->mCallback) |
@@ -760,3 +1170,22 @@ void LLPanelLogin::onClickVersion(void*) | |||
760 | { | 1170 | { |
761 | LLFloaterAbout::show(NULL); | 1171 | LLFloaterAbout::show(NULL); |
762 | } | 1172 | } |
1173 | |||
1174 | void LLPanelLogin::onClickForgotPassword(void*) | ||
1175 | { | ||
1176 | if (sInstance ) | ||
1177 | { | ||
1178 | LLWeb::loadURL(sInstance->childGetValue( "forgot_password_url" ).asString()); | ||
1179 | } | ||
1180 | } | ||
1181 | |||
1182 | |||
1183 | // static | ||
1184 | void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data) | ||
1185 | { | ||
1186 | if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE) | ||
1187 | { | ||
1188 | LLNotifyBox::showXml("CapsKeyOn"); | ||
1189 | sCapslockDidNotification = TRUE; | ||
1190 | } | ||
1191 | } | ||