00001
00032 #ifndef LL_LLPANELLOGIN_H
00033 #define LL_LLPANELLOGIN_H
00034
00035 #include "llpanel.h"
00036 #include "llcommandhandler.h"
00037 #include "lldbstrings.h"
00038 #include "llmemory.h"
00039 #include "llviewerimage.h"
00040 #include "llstring.h"
00041 #include "llmd5.h"
00042 #include "llwebbrowserctrl.h"
00043
00044 class LLTextBox;
00045 class LLLineEditor;
00046 class LLCheckBoxCtrl;
00047 class LLButton;
00048 class LLComboBox;
00049
00050
00051 class LLLoginHandler : public LLCommandHandler
00052 {
00053 public:
00054
00055 LLLoginHandler() : LLCommandHandler("login", true) { }
00056 bool handle(const LLSD& tokens, const LLSD& queryMap);
00057 bool parseDirectLogin(std::string url);
00058 void parse(const LLSD& queryMap);
00059
00060 LLUUID mWebLoginKey;
00061 LLString mFirstName;
00062 LLString mLastName;
00063 };
00064
00065 extern LLLoginHandler gLoginHandler;
00066
00067 class LLPanelLogin:
00068 public LLPanel,
00069 public LLWebBrowserCtrlObserver
00070 {
00071 LOG_CLASS(LLPanelLogin);
00072 public:
00073 LLPanelLogin(const LLRect &rect, BOOL show_server,
00074 void (*callback)(S32 option, void* user_data),
00075 void *callback_data);
00076 ~LLPanelLogin();
00077
00078 virtual BOOL handleKeyHere(KEY key, MASK mask);
00079 virtual void draw();
00080 virtual void setFocus( BOOL b );
00081
00082 static void show(const LLRect &rect, BOOL show_server,
00083 void (*callback)(S32 option, void* user_data),
00084 void* callback_data);
00085
00086 static void setFields(const std::string& firstname, const std::string& lastname,
00087 const std::string& password, BOOL remember);
00088
00089 static void addServer(const char *server, S32 domain_name);
00090 static void refreshLocation( bool force_visible );
00091
00092 static void getFields(LLString &firstname, LLString &lastname,
00093 LLString &password, BOOL &remember);
00094
00095 static BOOL getServer(LLString &server, S32& domain_name);
00096 static void getLocation(LLString &location);
00097
00098 static void close();
00099
00100 void setSiteIsAlive( bool alive );
00101
00102 static void loadLoginPage();
00103 static void giveFocus();
00104 static void setAlwaysRefresh(bool refresh);
00105 static void mungePassword(LLUICtrl* caller, void* user_data);
00106
00107 private:
00108 static void onClickConnect(void*);
00109 static void onClickNewAccount(void*);
00110 static void newAccountAlertCallback(S32 option, void*);
00111 static void onClickQuit(void*);
00112 static void onClickVersion(void*);
00113 virtual void onNavigateComplete( const EventType& eventIn );
00114 static void onClickForgotPassword(void*);
00115 static void onPassKey(LLLineEditor* caller, void* user_data);
00116 static void onSelectServer(LLUICtrl*, void*);
00117
00118 private:
00119 LLPointer<LLUIImage> mLogoImage;
00120
00121 void (*mCallback)(S32 option, void *userdata);
00122 void* mCallbackData;
00123
00124 std::string mIncomingPassword;
00125 std::string mMungedPassword;
00126
00127 static LLPanelLogin* sInstance;
00128 static BOOL sCapslockDidNotification;
00129 BOOL mHtmlAvailable;
00130 };
00131
00132 #endif